/* GUI CONVERTED from rqtotdsp.p (converter v1.75) Sat Aug 12 23:13:33 2000 */
/* rqtotdsp.p - REQUISITION DISPLAY TOTALS                                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/* All rights reserved worldwide.  This is an unpublished work.            */
/*V8:ConvertMode=Maintenance                                               */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                    */
/* Revision: 8.6      LAST MODIFIED: 04/22/97   By: *J1Q2* B. Gates        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane       */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan      */
/* REVISION: 8.6E     LAST MODIFIED: 07/20/98   BY: *L040* Brenda Milton   */
/* REVISION: 8.5      LAST MODIFIED: 08/12/98   BY: *J2W4* Patrick Rowan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 05/12/00   BY: *N09X* Antony Babu      */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */

/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */

/*!THIS VERSION IS USED FOR GUI DISPLAY OUTPUT. CHANGES MADE TO THIS PROGRAM
MAY NEED TO BE MADE TO RQTOTDSP.P ALSO.*/

     {mfdeclre.i}
     {gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rqtotdsp_p_1 "Requisition Totals"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

         define input parameter p_rqm_recid as recid no-undo.
         define output parameter p_frame_hdl as handle no-undo.

         define variable rqmcurr1 like rqm_curr no-undo.
         define variable rqmcurr2 like rqm_curr no-undo.
         define variable rqmapprcurr1 like rqm_curr no-undo.
         define variable rqmapprcurr2 like rqm_curr no-undo.
/*J2W4*  define variable rqmapprtotal like rqm_total no-undo.
 *       define variable rqmapprmaxtotal like rqm_max_total no-undo.
 *J2W4*/
/*J2W4*/ define variable rqmapprtotal like rqm_total no-undo
/*J2W4*/                           decimals 10 format "ZZZZ,ZZZ,ZZ9.99".
/*J2W4*/ define variable rqmapprmaxtotal like rqm_max_total no-undo
/*J2W4*/                           decimals 10 format "ZZZZ,ZZZ,ZZ9.99".
         define variable exchg_rate as decimal no-undo.
/*L040*/ define variable exchg_rate2 as decimal no-undo.
/*L040*/ define variable exchg_ratetype like exr_ratetype no-undo.
         define variable rndmthd as character no-undo.
         define variable formatstring as character no-undo.
/*N09X** define variable titlestring as character */
/*N09X**    initial {&rqtotdsp_p_1} no-undo. */
/*N09X*/ define variable titlestring as character no-undo.
/*L040*/ define variable mc-error-number like msg_nbr no-undo.

/*N09X*/ titlestring = getFrameTitle("REQUISITION_TOTALS",25).

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
rqm_total       colon 25
            rqmcurr1        no-label
            rqmapprtotal    at 55 no-label
            rqmapprcurr1    no-label
            rqm_max_total   colon 25
            rqmcurr2        no-label
            rqmapprmaxtotal at 55 no-label
            rqmapprcurr2    no-label
          SKIP(.4)  /*GUI*/
with frame a attr-space side-labels width 80
          NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = titlestring.
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

         find first rqf_ctrl no-lock.
/*L040*  find first gl_ctrl no-lock. */
         find rqm_mstr where recid(rqm_mstr) = p_rqm_recid no-lock.

         /* SET CURRENCY DISPLAY FORMATS */

/*L040*  if rqm_curr = gl_base_curr then do: */
/*L040*     rndmthd = gl_rnd_mthd. */
/*L040*  end. */
/*L040*  else do: */
/*L040*     rndmthd = ?. */
/*L040*     find first ex_mstr where ex_curr = rqm_curr no-lock no-error. */
/*L040*     if available ex_mstr then rndmthd = ex_rnd_mthd. */
/*L040*  end. */

/*L040*/ /* GET ROUNDING METHOD FROM CURRENCY MASTER */
/*L040*/ {gprunp.i "mcpl" "p" "mc-get-rnd-mthd"
           "(input rqm_curr,
             output rndmthd,
             output mc-error-number)"}
/*L040*/ if mc-error-number <> 0 then do:
/*L040*/    {mfmsg.i mc-error-number 2}
/*L040*/ end.

         formatstring = rqm_total:format in frame a.

         {gprun.i ""gpcurfmt.p""
           "(input-output formatstring, input rndmthd)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         rqm_total:format in frame a = formatstring.

         formatstring = rqm_max_total:format in frame a.

         {gprun.i ""gpcurfmt.p""
           "(input-output formatstring, input rndmthd)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         rqm_max_total:format in frame a = formatstring.

/*L040*  if rqf_appr_curr = gl_base_curr then do: */
/*L040*     rndmthd = gl_rnd_mthd. */
/*L040*  end. */
/*L040*  else do: */
/*L040*    rndmthd = ?. */
/*L040*    find first ex_mstr where ex_curr = rqf_appr_curr no-lock no-error. */
/*L040*    if available ex_mstr then rndmthd = ex_rnd_mthd. */
/*L040*  end. */
/*L040*/ /* GET ROUNDING METHOD FROM CURRENCY MASTER */
/*L040*/ {gprunp.i "mcpl" "p" "mc-get-rnd-mthd"
           "(input rqf_appr_curr,
             output rndmthd,
             output mc-error-number)"}
/*L040*/ if mc-error-number <> 0 then do:
/*L040*/    {mfmsg.i mc-error-number 2}
/*L040*/ end.

         formatstring = rqmapprtotal:format in frame a.

         {gprun.i ""gpcurfmt.p""
           "(input-output formatstring, input rndmthd)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         rqmapprtotal:format in frame a = formatstring.

         formatstring = rqmapprmaxtotal:format in frame a.

         {gprun.i ""gpcurfmt.p""
           "(input-output formatstring, input rndmthd)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         rqmapprmaxtotal:format in frame a = formatstring.

         /* GET CURRENT EXCHANGE RATE TO APPROVAL CURRENCY */

/*L040*  {gprun.i ""rqapexrt.p""
 *         "(input rqm_curr,
 *           output exchg_rate)"}
 *L040*/

/*L040*/ {gprun.i ""rqexrt.p""
           "(input rqm_curr,
             input rqf_appr_curr,
             input exchg_ratetype,
             output exchg_rate,
             output exchg_rate2,
             output mc-error-number)"}
/*GUI*/ if global-beam-me-up then undo, leave.


/*L040*  if exchg_rate = ? then do: */
/*L040*/ if mc-error-number <> 0 then do:
            {mfmsg.i 2087 2}
            /* No exchange rate for approval currency */
            rqmapprtotal = ?.
            rqmapprmaxtotal = ?.
         end.
         else do:
/*L040*     rqmapprtotal = rqm_total / exchg_rate. */
/*L040*     rqmapprmaxtotal = rqm_max_total / exchg_rate. */
/*L040*/    /* CONVERT TO APPROVAL CURRENCY */
/*L040*/    {gprunp.i "mcpl" "p" "mc-curr-conv"
              "(input rqm_curr,
                input rqf_appr_curr,
                input exchg_rate,
                input exchg_rate2,
                input rqm_total,
                input false, /* DO NOT ROUND */
                output rqmapprtotal,
                output mc-error-number)"}
/*L040*/    {gprunp.i "mcpl" "p" "mc-curr-conv"
              "(input rqm_curr,
                input rqf_appr_curr,
                input exchg_rate,
                input exchg_rate2,
                input rqm_max_total,
                input false, /* DO NOT ROUND */
                output rqmapprmaxtotal,
                output mc-error-number)"}
         end.

         /*DISPLAY*/

         display
            rqm_total
            rqm_curr @ rqmcurr1
            rqm_max_total
            rqm_curr @ rqmcurr2
            rqmapprtotal
            rqf_appr_curr @ rqmapprcurr1
            rqmapprmaxtotal
            rqf_appr_curr @ rqmapprcurr2
         with frame a.

         p_frame_hdl = frame a:handle.
